package com.baselibrary.test.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.baselibrary.libs.Utils.UtilsTimer.UtilsTimer;
import com.baselibrary.libs.Utils.log.LogUtils;
import com.baselibrary.libs.Utils.netUtils.NoHttp.queueList.QueueNetWork;
import com.baselibrary.libs.View.TextView_plus.NoDoubleTextView;
import com.baselibrary.libs.View.bar.initAction_Bar;
import com.baselibrary.libs.base.baseActivity.BaseActivity;
import com.baselibrary.test.MVP.Main7Activity.chengshibean;
import com.baselibrary.test.MVP.Main7Activity.contract.Main7Contract;
import com.baselibrary.test.MVP.Main7Activity.presenter.Main7Presenter;
import com.baselibrary.test.MVP.Main7Activity.sohu;
import com.baselibrary.test.R;
import com.baselibrary.test.app.AppContext;

/**
 * 不能连续点击两次的按钮+网络带二级缓存的网络访问activity
 */
public class Main7Activity extends BaseActivity implements NoDoubleTextView.OnDoubleClickListener, Main7Contract.View, View.OnClickListener {

   // http://127.0.0.1:8080/123.txt
   // public String url = "http://www.csdn.net/";
    private NoDoubleTextView nodouble;
    private initAction_Bar action_bar;
    private QueueNetWork mControlQueue;

    private Main7Presenter mPresenter;
    private TextView mUi;
    private TextView mUi1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


    }

    @Override
    public int getlayouXML() {
        return R.layout.activity_main7;
    }

    @Override
    public void initP() {

        mPresenter = new Main7Presenter(this);
    }

    @Override
    public void initView() {

        nodouble = (NoDoubleTextView) findViewById(R.id.nodouble);
        nodouble.setOnDoubleClickListener(this);
        action_bar = (initAction_Bar) findViewById(R.id.action_bar);
        action_bar.set_Title("不能连续点击两次的按钮");

        mUi = (TextView)findViewById(R.id.ui);
        mUi1 = (TextView)findViewById(R.id.ui1);

        mUi.setOnClickListener(this);
        mUi1.setOnClickListener(this);
    }

    @Override
    public void initData() {

    }

    @Override
    public void initListener() {

    }


    @Override
    public void onClicks(NoDoubleTextView view) {
        LogUtils.i("我点击了按钮");

//        hashtable.put("name","yanzhenjie");
//        hashtable.put("pwd","123");

        mPresenter.getNet();


    }

    @Override
    public void succeed(chengshibean o) {
        LogUtils.i("更新ui 的操作"+o);
        mUi.setText(o.toString());
    }

    @Override
    public void succeed1(sohu chengshibean) {
        LogUtils.i("更新ui 的操作"+chengshibean);
        mUi1.setText(chengshibean.toString());
    }

    @Override
    public void onClick(View v) {
        if (UtilsTimer.isFastDoubleClickOpen(AppContext.getApplication(),1,1)) {
            return;
        }
        switch (v.getId()){
            case R.id.ui:

            break;
            case R.id.ui1:

            break;
        }
    }
}
